var express = require("express");
var router = express.Router();


let { studentModel } = require("../models/studentModel") //导入学生模型

//修改学生信息
router.post("/updateStudent", async (req, res) => {
    let { matchedCount } = await studentModel.updateOne(
        { phone: req.body.phone },
        {
            name: req.body.name,
            gender: req.body.gender,
            password: req.body.password,
        }
    );
    // console.log(matchedCount);
    console.log(req.body);

    if (matchedCount == 1) {
        res.send({
            code: 200,
            message: "修改成功",
        });
    } else {
        res.send({
            code: 201,
            message: "修改不成功",
        });
    }
});

module.exports = router;